package net.ibizsys.eclipse.studio.xml;

import net.ibizsys.eclipse.studio.util.StringKit;

/**
 * 实体视图
 * 
 * @author <a href='http://www.weibo.com/xjtoo' target='_blank'>Enmaai</a>
 */
public class IBizDEView extends IBizView
{
	public static final String NODE_PSAPPDEVIEW = "PSAPPDEVIEW";

	/**
	 * 实体视图名称
	 */
	public static final String ATTR_PSDEVIEWNAME = "PSDEVIEWNAME";

	/**
	 * 实体标识
	 */
	public static final String ATTR_PSDEID = "PSDEID";

	/**
	 * 实体名称
	 */
	public static final String ATTR_PSDENAME = "PSDENAME";

	private String deViewName;
	private String deId;
	private String deName;

	@Override
	protected void initAttribute(String name, String value)
	{
		if (StringKit.IsEqual(ATTR_PSDEVIEWNAME, name, true))
		{
			this.deViewName = value;
			return;
		}
		if (StringKit.IsEqual(ATTR_PSDEID, name, true))
		{
			this.deId = value;
			return;
		}
		if (StringKit.IsEqual(ATTR_PSDENAME, name, true))
		{
			this.deName = value;
			return;
		}
		super.initAttribute(name, value);
	}

	public String getDEViewName()
	{
		return deViewName;
	}

	public String getDEId()
	{
		return deId;
	}

	public String getDEName()
	{
		return deName;
	}

	@Override
	public boolean match(String keyword)
	{
		if (super.match(keyword))
		{
			return true;
		}
		if (StringKit.has(getDEViewName(), keyword) || StringKit.has(getDEId(), keyword) || StringKit.has(getDEName(), keyword))
		{
			return true;
		}

		return false;
	}
}
